<admintpl file="header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:U('Admin/Special/specialAdd',array('news_id'=>$news_id,$id_type=>$id_val))}">编辑专题</a></li>
			<li><a href="{:U('Admin/Special/special_column_index',array('special_id'=>$news_id,$id_type=>$id_val))}">专题分栏</a></li>
			<li><a href="{:U('Admin/Special/index',array('news_id'=>$news_id,'special_id'=>0,$id_type=>$id_val))}">文章管理</a></li>
		</ul>
		<form method="post" class="form-horizontal" id="pub_form" action="{:U('Admin/Special/specialAddok')}" enctype="multipart/form-data" >
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">*专题名称：</label>
					<div class="span3">
						<input type="text" name="title"  style="width: 556px;" value="{$news_info.title}">
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">副标：</label>
					<div class="span3">
						<input type="text" name="subTitle"  style="width: 556px;" value="{$news_info.subtitle}">
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">关键字：</label>
					<div class="span3">
						<input type="text" name="keyword"  style="width: 556px;" value="{$news_info.keywords}">
					</div>
				</div>
				
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">权重：</label>
					<div class="span3">
						<input type="text" name="weight"  style="width: 556px;" value="{$news_info.weight}">
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">标签：</label>
					<div class="span3">
						<input type="text" name="tags"  style="width: 556px;"  value="{$news_info.tags}">
					</div>
				</div>
				<div class="control-group">
					<label class="span2 control-label" style="width: 90px;">专题摘要：</label>
					<div class="span7">
						<textarea style="width: 556px; height: 60px;" name="abstract">{$news_info.abstract}</textarea>
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">是否置顶：</label>
					<div class="span3">
						<label class="radio inline" for="lightup_true"> <input type="radio" id="top_status" <if condition="$news_info.top_status eq 1"> checked </if> class="radio" name="top_status" value="1" />是</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<label class="radio inline" for="lightup_false"> <input type="radio" id="top_status" <if condition="$news_info.top_status eq 0"> checked </if> class="radio" name="top_status" value="0" />否</label>
					</div>
				</div>

			<if condition="$id_type eq 'column_id'">
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">栏目类型：</label>
					<div class="span3">
						<select class="select_2" name="column_type" id="column_type" >
							<option value="0">全部</option>
							<foreach name="type_list" item="vo">
								<option value="{$vo.type_id}" <?php if($vo['type_id'] == $news_info['type_id']) echo "selected"?> >{$vo.name}</option>
							</foreach>
						</select>
					</div>
				</div>
			</if>

				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">封面图片：</label>
					<div class="span4 wrapper">
						<div id="uploader-image">
							<div id="fileList" class="uploader-list">
								<div id="imageDiv" class="file-item thumbnail" style="width:150px;height: 150px;">
								<?php if($news_info['cover_image']){?>
									<img id="imagePreview" src="<?php echo $news_info['cover_image']?>" style="width:150px;height: 140px;">
								<?php }else{?>
									<img id="imagePreview" src="__PUBLIC__/images/furley_bg.png" style="width:150px;height: 140px;">
								<?php }?>
									
									<div id="picker" class="info">选择图片&nbsp;&nbsp;&nbsp;&nbsp;</div>
									<input style="display:none;" type="file" id="imageFile" name="imageFile" >
								</div>
							</div>
						</div>
					</div><div style="color:red;float:left;margin-top:140px">*专题详细封面  尺寸：1080*328  格式：JPG/PNG</div>
				</div>
				
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">是否添加图片水印：</label>
					<div class="span3">
						<label class="radio inline" for="lightup_true"> <input type="radio" id="water_true" class="radio" name="water" value="1"  <if condition="$news_info.is_watermark eq 1"> checked </if> />开启</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

						<label class="radio inline" for="lightup_false"> <input type="radio" id="water_false"  class="radio" name="water" value="0"  <if condition="$news_info.is_watermark eq 0">checked </if> />关闭</label>


					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">关联选手：</label>
					<div class="span3">
						<select name="competitor_id">
							<option value="">请选择</option>
							<foreach name="competitor_list" item="vo">
								<option value="{$vo.competitor_id}" <?php if($vo['competitor_id'] == $news_info['competitor_id']) echo "selected"?>>{$vo.real_name}</option>
							</foreach>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">发布渠道：</label>
					<div class="span3">
						<label class="radio inline" for="lightup_true"> <input type="checkbox" <if condition="$news_info.app_pub eq 1"> checked </if> id="pub" class="radio" name="pub[]" value="1" />APP</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<label class="radio inline" for="lightup_false"> <input type="checkbox" id="pub" <if condition="$news_info.web_pub eq 1"> checked </if>  class="radio" name="pub[]" value="2" />门户</label>
					</div>
				</div>

			<input type="hidden" name="{$id_type}" value="{$id_val}">
			<input type="hidden" name="news_id" value="{$news_info.news_id}">
			<input type="hidden" name="hidimg" value="{$news_info.cover_image}">
			<div class="form-actions" style="padding-left:260px;">
				<button type="submit" id="publish" class="btn" data-type="add">发布</button>
				&nbsp;&nbsp;<a class="btn" href="{:U('Admin/News/index')}">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
	<script type="text/javascript">
		//编辑器路径定义
		var editorURL = GV.DIMAUB;
	</script>
	<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"></script>
	<script type="text/javascript" >
		$(document).ready(function () {
			$("#edui1_iframeholder").html(<?php echo $vo['content'];?>);
			$('#upperId').change(function () {
				$.get('{:U("Admin/News/ajax_get_cate")}' + '&upperId=' + $('#upperId').val(), function (data) {
					var html = '<option value="0">--无--</option>';
					if(data['state']=="success"){
						html = '<option value="-1">全部</option>';
						for (var a in data.newsCategoryList) {
							html += '<option value="' + data.newsCategoryList[a].cateId + '">' + data.newsCategoryList[a].cateName + '</option>';
						}
					}
					$('#categoryId').html(html);
				});
			});
			$('#channelId').change(function () {
				$.get('{:U("Admin/News/ajax_get_subject")}' + '&cateId=' + $('#channelId').val(), function (data) {
					var html = '<option value="0">--无--</option>';
					if(data['state']=="success"){
						html = '<option value="-1">全部</option>';
						for (var a in data.tagList) {
							html += '<option value="' + data.tagList[a].tagTitle + '">' + data.tagList[a].tagTitle + '</option>';
						}
					}
					$('#subjectId').html(html);
				});
			});
		});
	    $(function() {
				//编辑器
				editorcontent = new baidu.editor.ui.Editor();

				editorcontent.render('content');
				try {
					editorcontent.sync();
				} catch (err) {
				}
				//增加编辑器验证规则
				jQuery.validator.addMethod('editorcontent', function() {
					try {
						editorcontent.sync();
					} catch (err) {
					}
					return editorcontent.hasContents();
				});
				var form = $('form.js-ajax-forms');
				//ie处理placeholder提交问题
				if ($.browser.msie) {
					form.find('[placeholder]').each(function() {
						var input = $(this);
						if (input.val() == input.attr('placeholder')) {
							input.val('');
						}
					});
				}
			////-------------------------
		});

		function html5Reader(file, previewId){
			var file = file.files[0];
			var reader = new FileReader();
			reader.readAsDataURL(file);
			reader.onload = function(e){
				$('#'+previewId).attr('src', this.result);
			}
		}
		function image_change(fileId, previewId) {
			var pic = document.getElementById(previewId),
					file = document.getElementById(fileId);

			var ext = file.value.substring(file.value.lastIndexOf(".")+1).toLowerCase();

			// gif在IE浏览器暂时无法显示
			if(ext != 'png' && ext != 'jpg' && ext != 'jpeg'){
				alert("图片的格式必须为png或者jpg或者jpeg格式！");
				return;
			}
			var isIE = navigator.userAgent.match(/MSIE/)!= null,
					isIE6 = navigator.userAgent.match(/MSIE 6.0/)!= null;

			if(isIE) {
				file.select();
				var realLocalPath = document.selection.createRange().text;

				// IE6浏览器设置img的src为本地路径可以直接显示图片
				if (isIE6) {
					pic.src = realLocalPath;
				}else {
					// 非IE6版本的IE由于安全问题直接设置img的src无法显示本地图片，但是可以通过滤镜来实现
					pic.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='image',src=\"" + realLocalPath + "\")";
					// 设置img的src为base64编码的透明图片 取消显示浏览器默认图片
					pic.src = '';
				}
			}else {
				html5Reader(file, previewId);
			}
		}

		$("#picker").click(function(){
			$("#imageFile").click();
		});

		$("#imageFile").change(function(){
			image_change('imageFile', 'imagePreview');
		});
	</script>
</body>
</html>